<tpl> if $area_array.area_id != "" </tpl> <tpl> assign var='action' value='updatearea' </tpl>
<tpl> else </tpl> <tpl> assign var='action' value='savearea' </tpl> <tpl> /if </tpl>
<form id="form1" name="form1" method="post" action="area.manage.php" style="margin-bottom:20px; ">
<input type="hidden" name="action" value="<tpl> $action </tpl>" />
<input name="txtAreaId" type="hidden" id="txtAreaId" value="<tpl> $area_array.area_id </tpl>" />
  <table class="from_table">
    <tr>
      <th width="123" class="th2"><tpl> $langArea </tpl>：</th>
      <td width="530" align="left" class="td1"><input name="txtAreaName" maxlength="20" type="text" class="txtinput" id="txtAreaName" value="<tpl> $area_array.area_name </tpl>" />      
		<label style="display:none" for="txtAreaName" class="wrong" metaDone="true" generated="true"></label>		</td>
    </tr>
    <tr>
      <th class="th2"><tpl> $langUpArea </tpl>：</th>
      <td width="530" align="left" class="td1">
	  	<select name="txtArea" id="txtArea">
			<option value="0" <tpl> if '0' eq $area_array.area_parent_id </tpl>selected="selected"<tpl> /if </tpl>><tpl> $langAreaDefault </tpl></option>
			<tpl> section name=loop loop=$sel_area </tpl>
			<option <tpl> if $sel_area[loop][0] eq $area_array.area_parent_id </tpl>selected="selected"<tpl> /if </tpl> value="<tpl> $sel_area[loop][0] </tpl>"><tpl> $sel_area[loop][2] </tpl></option>
			<tpl> /section </tpl>
		</select>
	  </td>
    </tr>
    <tr>
      <th class="th2"><tpl> $langAreaIntro </tpl>：</th>
      <td width="530" align="left" class="td1"><textarea name="txtAreaIntro" cols="50"class="tarea" rows="8" id="txtAreaIntro"><tpl> $area_array.area_intro </tpl></textarea>      </td>
    </tr>
	<tr>
      <th class="th2"><tpl>$langAreaSort</tpl>：</th>
      <td width="530" align="left" class="td1"><input name="txtAreaSort" type="text" class="txtinput" id="txtAreaSort" value="<tpl> $area_array.area_sort </tpl>" size="10" />
		  <label style="display:none" for="txtAreaSort" class="wrong" metaDone="true" generated="true"></label>		  </td>
    </tr>
    <tr>
      <td>
</td>
      <td width="530" align="left"> <span class="btn_left">
	  <input type="submit" class="btn_submit" name="Submit" value="<tpl> $langSaveArea </tpl>" />　	  </span>
	  <span class="btn_left">
		<input id="butt_list" class="btn_submit" type="button" value="<tpl> $backAreaList </tpl>" />
		</span>	</td>

    </tr>
  </table>
</form>
<script>
$(document).ready(function() {
	hideMessage();		
	
	//返回列表
	$("#butt_list").click(function(){
		ShowDiv = "result_content";
		getPageContent("area.manage.php?action=ajax_list");
	});	
//编辑
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ShowDiv	= 'result_content';
								getPageContent("area.manage.php?action=ajax_list");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			txtAreaName: {required:true},
			txtAreaIntro: {required:true},
			txtAreaSort: {required:true,number:true}
			
		},
		messages: {
			txtAreaName: {required: "<tpl> $errEmptyAreaName </tpl>"},
			txtAreaIntro: {required: "<tpl> $errEmptyAreaIntro </tpl>"},
			txtAreaSort: {required:"<tpl> $errAreaSort </tpl>",number:"<tpl> $errAreaSortIsNum </tpl>"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>